// components/cell-components/cart-cell-component.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    item: {
      type: Object,
      value: {}
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    _action_less: function () {
      var tmpItem = this.data.item;
      if (tmpItem.count > 0) {
        tmpItem.count -= 1;
        this.setData({
          item: tmpItem
        });
      }
      this.triggerEvent('count', tmpItem, "myEventOption")
    },
    _action_plus: function () {
      var tmpItem = this.data.item;
      if (tmpItem.count < 99) {
        tmpItem.count += 1;
        this.setData({
          item: tmpItem
        });
      }
      this.triggerEvent('count', tmpItem, "myEventOption")
    },
    _action_check: function (event) {
      var tmpItem = this.data.item;
      tmpItem.is_selected = event.detail.checked;
      this.triggerEvent('selected', tmpItem, "myEventOption")
    },
  }
})
